package BookMethods;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReviseMethod implements BookMethods{

    @Override
    public void method(BookList booklist) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("输入要修改的书的名字");
        String bookName = scanner.nextLine();


        for (int i = 0; i < booklist.getUsedSize(); i++) {
            Book book = booklist.getBook()[i];
            if (bookName.equals(book.getBookName())) {
                System.out.print("输入书名: ");
                book.setBookName(scanner.nextLine());

                System.out.print("输入作者: ");
                book.setAuthor(scanner.nextLine());

                System.out.print("输入价格: ");
                book.setPrice(scanner.nextInt());

                scanner.nextLine();

                System.out.print("输入类型: ");
                book.setType(scanner.nextLine());

                System.out.println("修改成功");
                return;
            }
        }

        System.out.println("未找到该书");
    }
}
